#include "main.h"

#include "resource.h"


int g_mode = 0;
void import_setmode(int mode)
{
	g_mode = mode;
}


INT_PTR CALLBACK import_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch(message)
	{
	case WM_INITDIALOG:
		if(g_mode)
		{
			CheckRadioButton(hWnd,IDC_RADIO1,IDC_RADIO2,IDC_RADIO2);
			EnableWindow( GetDlgItem(hWnd,IDC_EDIT1) , FALSE);
			EnableWindow( GetDlgItem(hWnd,IDC_EDIT2) , FALSE);
			SetFocus( GetDlgItem(hWnd,IDC_EDIT3));
		}
		else
		{
			CheckRadioButton(hWnd,IDC_RADIO1,IDC_RADIO2,IDC_RADIO1);
			EnableWindow( GetDlgItem(hWnd,IDC_EDIT3) , FALSE);
			EnableWindow( GetDlgItem(hWnd,IDC_BUTTON1) , FALSE);
			SetFocus( GetDlgItem(hWnd,IDC_EDIT1));
		}
		ImmDisableIME(1);
		break;
	case WM_DESTROY:
		ImmDisableIME(0);
		break;
	case WM_COMMAND:
		{
			switch(wParam)
			{
			case IDC_RADIO1:
				EnableWindow( GetDlgItem(hWnd,IDC_EDIT3) , FALSE);
				EnableWindow( GetDlgItem(hWnd,IDC_BUTTON1) , FALSE);

				EnableWindow( GetDlgItem(hWnd,IDC_EDIT1) , TRUE);
				EnableWindow( GetDlgItem(hWnd,IDC_EDIT2) , TRUE);
				SetFocus( GetDlgItem(hWnd,IDC_EDIT1));
				break;
			case IDC_RADIO2:
				EnableWindow( GetDlgItem(hWnd,IDC_EDIT1) , FALSE);
				EnableWindow( GetDlgItem(hWnd,IDC_EDIT2) , FALSE);

				EnableWindow( GetDlgItem(hWnd,IDC_EDIT3) , TRUE);
				EnableWindow( GetDlgItem(hWnd,IDC_BUTTON1) , TRUE);
				SetFocus( GetDlgItem(hWnd,IDC_EDIT3));
				break;
			case IDOK:
				if(IsDlgButtonChecked(hWnd,IDC_RADIO1))
				{
					wchar_t szbianma[256];
					wchar_t szcitao[256];

					GetDlgItemTextW(hWnd,IDC_EDIT1,szbianma,256);
					GetDlgItemTextW(hWnd,IDC_EDIT2,szcitao,256);
					


					break;
				}
				else
				{
				}
				break;
			case ID_EXIT:
			case IDCANCEL:
				EndDialog(hWnd,0);
				break;
			}
		}
		break;
		
	}
	return 0;
}